#include "Log.h"

#include <stdarg.h>

bool Log::enable = false;

FILE * Log::fp = NULL;

Log::Log(void)
{
}

Log::~Log(void)
{
}

void Log::Enable()
{
    enable = true;

    fp = fopen("log.txt", "a");
}

void Log::Disable()
{
    enable = false;

    if (NULL != fp)
    {
        fclose(fp);
        fp = NULL;
    }
}

void Log::Trace(const char *format, ...)
{
    if (enable)
    {
        va_list argList;
        va_start(argList, format);

        vfprintf(fp, format, argList);

        va_end(argList);
    }
}
